package models

import "gorm.io/gorm"

type New struct {
	gorm.Model
	Title   string  `json:"title" gorm:"type:varchar(100)"`
	Content string  `json:"content" gorm:"type:varchar(255)"`
	Img     string  `json:"img" gorm:"type:varchar(100)"`
	CateId  uint    `json:"cateId" gorm:"type:int(10)"`
	State   string  `json:"state" gorm:"type:varchar(100)"`
	NewType NewType `gorm:"foreignKey:CateId"`
	//Comment []Comment
}

type NewType struct {
	gorm.Model
	Types string `json:"types" gorm:"type:varchar(100)"`
}

type User struct {
	gorm.Model
	Username string `json:"username"  gorm:"type:varchar(255)"`
	Password string `json:"password"  gorm:"type:varchar(255)"`
}

type Commit struct {
	gorm.Model
	Content string `json:"content" gorm:"type:varchar(255)"`
	NewId   uint   `json:"newId"  gorm:"type:int(10)"`
	UserId  uint   `json:"UserId" gorm:"type:int(10)"`
	New     New    `gorm:"foreignKey:NewId"`
	User    User   `gorm:"foreignKey:UserId"`
}

type Collection struct {
	gorm.Model
	NewId  uint `json:"newId"  gorm:"type:int(10)"`
	UserId uint `json:"UserId" gorm:"type:int(10)"`
	New    New  `gorm:"foreignKey:NewId"`
	User   User `gorm:"foreignKey:UserId"`
}
